<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%@ page import="com.fh.web.util.PropertiesReader"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
//退出地址
String doLogOutURL = PropertiesReader.getInstance("/shiro.properties").getValue("shiro.doLogOutURL");
%>
<!DOCTYPE html>
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
	<title>基础资源库统一平台门户</title>
    <link href="${ctx}/images/logo-icon.png" rel="icon">
	<c:set var="ctx" value="${pageContext.request.contextPath}"/>
	<jsp:include page="inc.jsp"></jsp:include>
  <meta name="renderer" content="webkit|ie-stand|ie-comp">
  <meta name="force-rendering" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <link rel="stylesheet" href="${ctx}/css/ui.css">
  <link rel="stylesheet" href="${ctx}/css/app.css">
  <script src="${ctx}/jslib/jquery-1.12.4.min.js"></script>
  <script src="${ctx}/jslib/ui.js"></script>
  <script src="${ctx}/jslib/app.js"></script>
  <script type="text/javascript" src="${ctx}/jslib/easyui1.4.2/jquery.easyui.min.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jslib/easyui1.4.2/locale/easyui-lang-zh_CN.js" charset="utf-8"></script>
</head>

<body>
  <div class="common-header">
    <div class="page-center">
      <div class="common-header-user">
       <a class="common-username">${sys_user.userName}，欢迎您！
         <ul>
            <li modal=".mo-change">修改密码</li>
          </ul>  
        </a>
        <!-- <a>登录</a> -->
         <!-- <span class="vline"></span> -->
        <shiro:hasPermission name="SYSTEM_MANAGER">
        	<span class="vline"></span>
			<a href="${ctx}/user/index" target="_blank">网站管理</a>
		</shiro:hasPermission>
		 <span class="vline"></span>
        <a href="<%=doLogOutURL%>">注销</a>
      </div>
      <a><img class="common-logo" src="images/logo@2x.png" height="47"></a>
    </div>
  </div>
  <div class="select-library">
    <div class="page-center">
      <ul class="library-main">
       <c:forEach items="${list}" var="subSysParamVo">
        <li>
        <c:choose>  
          <c:when test="${not empty subSysParamVo.subSysUrl}">
           <a onclick="javascript:window.open('${subSysParamVo.subSysUrl}','_blank')" >
            <img src="${subSysParamVo.subSysImg}">
            <span>${subSysParamVo.subSysName}</span>
          </a>
          </c:when>
          <c:otherwise>
            <a onclick="javascript:alert('系统正在建设中...');" >
            <img src="${subSysParamVo.subSysImg}">
            <span>${subSysParamVo.subSysName}</span>
          </a>
          </c:otherwise>
         </c:choose>  
        </li>
        </c:forEach>
       
      </ul>
    </div>
  </div>
  
 <div class="common-footer-thin footer-on-bottom">
   <div class="page-center">
     <p>地  址：江苏省南京市鼓楼区湖南路1号B座8楼<span class="common-span-width"></span>
       <br> Copyright 2008-2017 All Rights Reserved 江苏凤凰数字传媒有限公司 版权所有</p>
   </div>
 </div>
<script type="text/javascript">
  function updatePasword(){
    var oldPassword=$("#oldPassword").val();
	var newdPassword=$("#newdPassword").val();
	var password=$("#password").val();
	if(newdPassword.length<6){
     $("#message").html("密码输入长度不能小于6");
     return false;
    }	
    if(newdPassword != password){
     $("#message").html("两次密码输入不一致");
     return false;
    }
    if(oldPassword.length<1){
     $("#message").html("旧的密码输入不能为空");
     return false;
    }	
    jQuery.ajax({
		//ajax请求页面
		url:"${ctx}/user/updatePassword",
		type: "POST",
		async: "false",
		timeout: 30000,
		data: {"oldPassword":oldPassword,"newdPassword":newdPassword},
		success: function(ret) {
			if(ret==0){
				setTimeout(function(){ window.location.reload();},3000);
				window.nalert("修改成功");
				
			}
			if(ret==1){
			  $("#message").html("旧密码输入错误");
			}
		},
		error: function() {
			parent.$.messager.alert('错误', "数据异常，修改失败", 'error');
			//请求父页面关闭
			setTimeout(function(){ window.location.reload();},3000);
		}
	});	
  }
</script>
  <div class="mo-change bgfff mo-content none padding-30">
    <a class="icon-large icon-large-close" modal-close></a>
    <h2 class="f30 align-center padding-bottom-20">修改密码</h2>
    <div class="cerror margin-bottom-15" id="message"></div>
    <form class="form form-m20" id="updatePasword">
      <fieldset>
        <input id="oldPassword" type="text" class="input input-large" placeholder="请输入旧密码" >
      </fieldset>
      <fieldset>
        <input id="newdPassword" type="password" class="input input-large" placeholder="请输入新密码" >
      </fieldset>
      <fieldset>
        <input id="password" type="password" class="input input-large" placeholder="确认密码" >
      </fieldset>
    </form>
    <div class="align-center"><a class="button button-blue button-larger" href="javascript:updatePasword();">完成</a></div>
  </div>
</body>
</html>
